<template>
    <div>
        <el-input v-model="neName" style="width: 240px" placeholder="请输入员工名字"></el-input>
        <el-button type="primary" @click="reset">重置密码</el-button>
    </div>
</template>
<script>
import {ref} from "vue";
import {urls} from "@/api/api";
import {postP} from "@/api/request";
import {ElMessage, ElMessageBox} from "element-plus";


export default {
    setup() {
        const neName = ref("")
        const reset = () => {
            try {
                if(neName.value.trim() === ""){
                    ElMessage({
                        type: 'error',
                        message: `用户名不能为空 `,
                    })
                    return
                }

                ElMessageBox.alert('确定重置密码', '提示', {
                    confirmButtonText: '确定',
                    callback: () => {
                        ElMessage({
                            type: 'success',
                            message: `密码重置成功 `,
                        })
                    },
                })
                console.log(neName.value)
                const response = postP(urls.m().reset, {neName: neName.value})
                if (response.code === 200) {

                }
                console.log(response)
            } catch (error) {
                console.log(error)
            }
        }
        return {
            neName, reset
        }
    }
}
</script>